/*
 * Copyright (c) Jack魏 2023 - 2023, All Rights Reserved.
 */

package cn.jackwei.yiyi.controller.sys;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import cn.jackwei.yiyi.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台用户登录
 *
 * @author Jack魏
 * @since 2023/10/20
 */
@Slf4j
@Validated
@SaCheckLogin
@RestController
@RequestMapping("/sys")
@Tag(name = "系统用户登录接口", description = "系统用户登录接口")
public class SysLoginController {
    /**
     * 获取登录信息
     *
     * @return 登录信息
     */
    @Operation(summary = "获取登录信息", description = "输入账号和密码进行登录")
    @GetMapping("/getLoginInfo")
    public Result<Object> getLoginInfo() {
        return Result.success(StpUtil.getSession().get(StpUtil.getLoginIdAsString()));
    }
}
